from google.appengine.ext import db


class Site(db.Model):  
  crawl = db.BooleanProperty(default = False)  
  last_updated = db.DateTimeProperty(auto_now = True)
  @property
  def url(self):
    return self.key().name()[2:]

class ParsedPage(db.Model):
  site = db.ReferenceProperty()
  url = db.LinkProperty()
  last_updated = db.DateTimeProperty(auto_now = True)
  etag = db.StringProperty(default = None)
  last_modified = db.StringProperty(default = None)
  expires = db.DateTimeProperty(default = None)
  pics = db.TextProperty(default = '')
  has_pics = db.BooleanProperty(default = False)
  hashp = db.StringProperty(default = '')
  

class PageNotModified(Exception):
  pass

class ForbiddenByRobotsTxt(Exception):
  pass
  